/**
 * File Name	: DateTime.h
 * Location		: /Core/
 * Lib.Name		: Core.a
 * Designer		: OS (20-09-06)
 * Mod. 1 by	:
 */

#pragma once

namespace Core
{
	enum FDTypes
	{
		FDType_Read = 0,
		FDType_Write,
		FDType_Except
	};

	class InternetAddress;

	class System
	{
	public:
		/**
		 * Fungsi yang akan men-sleep selama p milli seconds
		 * @param p_MilliSeconds Jumlah milli detik akan tersleep
		 */
		static void MilliSleep(double p_MilliSeconds);

		static bool IsFDReady(int p_FD, FDTypes p_FDtype, int p_TimeOutMilliSeconds);

		static int Execute(std::string p_Path, std::string p_Command);

		static bool IsExecuted(int p_Pid);

		static int SendSignal(int p_Pid, int p_Signal);

		static void Terminate(int p_Pid);

		static std::string GetEnv(std::string p_Env);

		static InternetAddress GetPeerName(int p_SD);

		static std::string ToTimeString(unsigned long p_Seconds);

		static std::string ToRadixString(unsigned long p_Integer, unsigned char p_Radix);

		template <class T>
		static std::string ToString(T p_T)
		{
			std::ostringstream t_OStringStream;
			t_OStringStream << p_T;
			return t_OStringStream.str();
		}
	};
}
